<?xml version="1.0"?>
<!-- Example XML file for SoundHelix. Author: Thomas Schuerger. -->
<SoundHelix version="0.5+" xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="../includes/Standard-SongNameEngine.xml" />
  <structure>
    <bars>
      <random min="96" max="192" step="16" />
    </bars>
    <beatsPerBar>4</beatsPerBar>
    <ticksPerBeat>4</ticksPerBeat>
  </structure>
  <xi:include href="../includes/Standard-HarmonyEngine.xml" />
  <arrangementEngine class="SimpleArrangementEngine">
    <maxIterations>1000000</maxIterations>
    <minActivityCount>3</minActivityCount>
    <maxActivityCount>8</maxActivityCount>
    <maxActivityChangeCount>2</maxActivityChangeCount>
    <startActivityCounts>
      <random list="1,2,3,4|1,2,3,4,5" />
    </startActivityCounts>
    <stopActivityCounts>
      <random list="2,1|3,2|4,3,2" />
    </stopActivityCounts>
    <activityVector name="accomp">
      <stopShift>-2</stopShift>
      <minActive>10</minActive>
      <minSegmentLength>2</minSegmentLength>
    </activityVector>
    <activityVector name="arpeggio">
      <minActive>15</minActive>
      <maxActive>65</maxActive>
      <minSegmentLength>2</minSegmentLength>
    </activityVector>
    <activityVector name="melody">
      <startAfterSection>3</startAfterSection>
      <stopBeforeSection>1</stopBeforeSection>
      <stopShift>-3</stopShift>
      <minActive>10</minActive>
      <maxActive>35</maxActive>
      <maxSegmentCount>3</maxSegmentCount>
      <minSegmentLength>2</minSegmentLength>
      <maxSegmentLength>4</maxSegmentLength>
    </activityVector>
    <activityVector name="base_and_snare">
      <startAfterSection>1</startAfterSection>
      <startBeforeSection>4</startBeforeSection>
      <stopBeforeSection>0</stopBeforeSection>
      <stopAfterSection>3</stopAfterSection>
      <minActive>50</minActive>
      <maxActive>85</maxActive>
      <minSegmentLength>2</minSegmentLength>
      <maxSegmentLength>8</maxSegmentLength>
      <maxPauseLength>5</maxPauseLength>
      <minSegmentCount>2</minSegmentCount>
      <maxSegmentCount>4</maxSegmentCount>
    </activityVector>
    <activityVector name="hihat">
      <startAfterSection>0</startAfterSection>
      <stopBeforeSection>0</stopBeforeSection>
      <minActive>40</minActive>
      <maxActive>85</maxActive>
      <minSegmentLength>2</minSegmentLength>
    </activityVector>
    <activityVector name="pad">
      <minActive>10</minActive>
      <maxActive>70</maxActive>
      <minSegmentLength>2</minSegmentLength>
    </activityVector>
    <activityVector name="bass">
      <startAfterSection>0</startAfterSection>
      <minActive>15</minActive>
      <maxActive>80</maxActive>
      <minSegmentLength>2</minSegmentLength>
    </activityVector>
    <activityVector name="randombass">
      <startAfterSection>1</startAfterSection>
      <stopBeforeSection>0</stopBeforeSection>
      <minActive>15</minActive>
      <maxActive>80</maxActive>
      <minSegmentLength>2</minSegmentLength>
    </activityVector>

    <track>
      <instrument>arpeggio</instrument>
      <transposition>-12</transposition>
      <sequenceEngine class="ArpeggioSequenceEngine">
        <normalizeChords>false</normalizeChords>
        <obeyChordSections>true</obeyChordSections>
        <patternEngines>
          <patternEngine class="StringPatternEngine">
            <string>0:26000,1:26000,2:26000,1:26000</string>
          </patternEngine>
          <patternEngine class="StringPatternEngine">
            <string>0:26000,1:26000,2:26000,3:26000,4:26000,3:26000,2:26000,1:26000</string>
          </patternEngine>
          <patternEngine class="StringPatternEngine">
            <string>0:26000,1:26000,2:26000,3:26000,4:26000,5:26000,6:26000,7:26000,8:26000,7:26000,6:26000,5:26000,4:26000,3:26000,2:26000,1:26000</string>
          </patternEngine>
          <patternEngine class="StringPatternEngine">
            <string>0:26000,1:26000,2:26000,3:26000,4:26000,5:26000,6:26000,7:26000,8:26000,7:26000,6:26000,5:26000,4:26000,3:26000,2:26000,1:26000,0:26000,1:26000,2:26000,3:26000,4:26000,3:26000,2:26000,1:26000</string>
          </patternEngine>
          <patternEngine class="StringPatternEngine">
            <string>0:26000,1:26000,2:26000,3:26000,4:26000,5:26000,6:26000,7:26000,8:26000,7:26000,6:26000,5:26000,4:26000,3:26000,2:26000,1:26000,0:26000,1:26000,2:26000,3:26000,4:26000,5:26000,6:26000,5:26000,4:26000,3:26000,2:26000,1:26000</string>
          </patternEngine>
          <patternEngine class="StringPatternEngine">
            <string>0:26000,1:26000,2:26000,3:26000,4:26000,5:26000,6:26000,7:26000,8:26000,7:26000,6:26000,5:26000,4:26000,3:26000,2:26000,1:26000,0:26000,1:26000,2:26000,3:26000,4:26000,5:26000,6:26000,7:26000,8:26000,7:26000,6:26000,5:26000,4:26000,3:26000,2:26000,1:26000</string>
          </patternEngine>
        </patternEngines>
        <patternEngines>
          <patternEngine class="StringPatternEngine">
            <string>0:26000,1:26000,2:26000,1:26000</string>
          </patternEngine>
          <patternEngine class="StringPatternEngine">
            <string>0:26000,1:26000,2:26000,1:26000,2:26000,3:26000,2:26000,1:26000</string>
          </patternEngine>
          <patternEngine class="StringPatternEngine">
            <string>0:26000,1:26000,2:26000,1:26000,2:26000,3:26000,2:26000,3:26000,4:26000,3:26000,4:26000,5:26000,4:26000,3:26000,2:26000,1:26000</string>
          </patternEngine>
          <patternEngine class="StringPatternEngine">
            <string>0:26000,1:26000,2:26000,1:26000,2:26000,3:26000,2:26000,3:26000,4:26000,3:26000,4:26000,5:26000,4:26000,5:26000,6:26000,5:26000,6:26000,7:26000,6:26000,5:26000,4:26000,3:26000,2:26000,1:26000</string>
          </patternEngine>
          <patternEngine class="StringPatternEngine">
            <string>0:26000,1:26000,2:26000,1:26000,2:26000,3:26000,2:26000,3:26000,4:26000,3:26000,4:26000,5:26000,4:26000,5:26000,6:26000,5:26000,6:26000,7:26000,6:26000,7:26000,8:26000,7:26000,6:26000,5:26000,4:26000,3:26000,2:26000,1:26000</string>
          </patternEngine>
          <patternEngine class="StringPatternEngine">
            <string>0:26000,1:26000,2:26000,1:26000,2:26000,3:26000,2:26000,3:26000,4:26000,3:26000,4:26000,5:26000,4:26000,5:26000,6:26000,5:26000,6:26000,7:26000,6:26000,7:26000,8:26000,7:26000,8:26000,9:26000,8:26000,7:26000,6:26000,5:26000,4:26000,3:26000,2:26000,1:26000</string>
          </patternEngine>
          <patternEngine class="StringPatternEngine">
            <string>0:26000,1:26000,2:26000,1:26000,2:26000,3:26000,2:26000,3:26000,4:26000,3:26000,4:26000,5:26000,4:26000,5:26000,6:26000,5:26000,6:26000,7:26000,6:26000,7:26000,8:26000,7:26000,8:26000,9:26000,8:26000,7:26000,6:26000,5:26000,4:26000,3:26000,2:26000,1:26000,0:26000,1:26000,2:26000,1:26000,2:26000,3:26000,2:26000,3:26000,4:26000,3:26000,4:26000,5:26000,4:26000,3:26000,2:26000,1:26000</string>
          </patternEngine>
          <patternEngine class="StringPatternEngine">
            <string>0:26000,1:26000,2:26000,1:26000,2:26000,3:26000,2:26000,3:26000,4:26000,3:26000,4:26000,5:26000,4:26000,5:26000,6:26000,5:26000,6:26000,7:26000,6:26000,7:26000,8:26000,7:26000,8:26000,9:26000,8:26000,7:26000,6:26000,5:26000,4:26000,3:26000,2:26000,1:26000,0:26000,1:26000,2:26000,1:26000,2:26000,3:26000,2:26000,3:26000,4:26000,3:26000,4:26000,5:26000,4:26000,5:26000,6:26000,5:26000,6:26000,7:26000,6:26000,7:26000,8:26000,7:26000,8:26000,9:26000,8:26000,7:26000,6:26000,5:26000,4:26000,3:26000,2:26000,1:26000</string>
          </patternEngine>
        </patternEngines>
      </sequenceEngine>
      <activityVector>arpeggio</activityVector>
    </track>
    <track>
      <instrument>accomp</instrument>
      <transposition>-24</transposition>
      <sequenceEngine class="MultiPatternSequenceEngine">
        <patternEngines>
          <patternEngine class="StringPatternEngine">
            <string>-,-,-,-,5,-,-,-</string>
          </patternEngine>
          <patternEngine class="StringPatternEngine">
            <string>-,-,-,-,4,-,-,-</string>
          </patternEngine>
          <patternEngine class="StringPatternEngine">
            <string>-,-,-,-,3,-,-,-</string>
          </patternEngine>
          <patternEngine class="StringPatternEngine">
            <string>0,-,-,0,-,-,0,-,-,-,0,-,-,-,-,-,0,-,-,0,-,-,0,-,-,-,0,-,-,-,-,-,0,-,-,0,-,-,0,-,-,-,0,-,-,-,-,-,0,-,-,0,-,-,0,-,-,-,0,-,-,-,+,-,0,-,-,0,-,-,0,-,-,-,0,-,-,-,-,-,0,-,-,0,-,-,0,-,-,-,0,-,-,-,-,-,0,-,-,0,-,-,0,-,-,-,0,-,-,-,-,-,0,-,-,0,-,-,0,-,-,-,0,-,-,-,-1,+</string>
          </patternEngine>
        </patternEngines>
      </sequenceEngine>
      <activityVector>accomp</activityVector>
    </track>
    <track>
      <instrument>melody</instrument>
      <transposition>12</transposition>
      <sequenceEngine class="MelodySequenceEngine">
        <melodies>1,2,2,3</melodies>
        <minPitch>0</minPitch>
        <maxPitch>11</maxPitch>
        <pitchDistances>-2,-2,-1,-1,-1,-1,0,0,1,1,1,1,2,2</pitchDistances>
        <patternEngine class="RandomPatternEngine">
          <patternTicks>16</patternTicks>
          <patternString>
            <random list="A1,A2,A1,A3,A1,A2,A1,B1" />
          </patternString>
          <noteProbability>75</noteProbability>
          <legatoProbability>0</legatoProbability>
          <minVelocity>32767</minVelocity>
          <maxVelocity>32767</maxVelocity>
          <minActiveTicks>7</minActiveTicks>
          <maxActiveTicks>13</maxActiveTicks>
          <offsets>0,0,0,0,0,0,+,+,+,+,*,*</offsets>
          <noteLengths>2,2,2,3,2,2,2,1,2</noteLengths>
          <pauseLengths>2,2,2,2,1,2</pauseLengths>
          <pitchVelocityCorrelation>100</pitchVelocityCorrelation>
          <velocityExponent>3</velocityExponent>
        </patternEngine>
      </sequenceEngine>
      <activityVector>melody</activityVector>
    </track>

    <track>
      <instrument>percussion</instrument>
      <sequenceEngine class="DrumSequenceEngine">
        <pattern>
          <pitch>36</pitch>
          <patternEngine class="RandomFragmentPatternEngine">
            <patternTicks>16</patternTicks>
            <patternString>
              <random list="A1,B1,A1,B2,A1,B1,A1,B3|A1,A1,A1,B1,A1,A1,A1,B2,A1,A1,A1,B1,A1,A1,A1,B3" />
            </patternString>
            <pattern group="A">0,-,-,-,-,-,-,-,0,-,-,-,-,-,-,-</pattern>
            <pattern group="B">0,-,0,-,-,-,-,-,0,-,-,-,-,-,-,-|0,-,-,0,-,-,-,-,0,-,-,-,-,-,-,-|0,-,-,-,-,-,-,-,0,-,-,-,-,-,0,-|0,-,-,-,-,-,-,-,0,-,-,-,-,-,-,0|0,-,-,-,-,-,-,-,0,-,-,-,-,-,0,0</pattern>
          </patternEngine>
        </pattern>
        <pattern>
          <pitch>38</pitch>
          <patternEngine class="RandomFragmentPatternEngine">
            <patternTicks>8</patternTicks>
            <patternString>A1,A1,A1,B1,A1,A1,A1,C1,A1,A1,A1,B1,A1,A1,A1,C2</patternString>
            <pattern group="A">-,-,-,-,0,-,-,-</pattern>
            <pattern group="B">-,-,-,-,0,-,-,-|-,-,-,-,0,-,-,0</pattern>
            <pattern group="C">-,-,-,-,0,-,-,0|-,-,-,0,0,-,0,-|-,-,-,0,0,0,-,0|-,-,-,0,0,0,0,-</pattern>
          </patternEngine>
        </pattern>
        <pattern>
          <pitch>42</pitch>
          <patternEngine class="RandomFragmentPatternEngine">
            <patternTicks>4</patternTicks>
            <patternString>A1,A2,A1,A3,A1,A2,A1,A4</patternString>
            <pattern group="A">0:26000,0:26000,0:26000,0:26000|0:26000,0:26000,-,0:26000|0:26000,-,-,-|0:26000,-,0:26000,-|0:26000,0:26000,0:26000,-</pattern>
          </patternEngine>
        </pattern>
        <pattern>
          <pitch>46</pitch>
          <patternEngine class="RandomFragmentPatternEngine">
            <patternTicks>8</patternTicks>
            <patternString>A1,B1,A1,B2,A1,B1,A1,B3</patternString>
            <pattern group="A">-,-,0:20000,-,-,-,0:20000,-</pattern>
            <pattern group="B">-,-,0:20000,-,-,-,0:20000,-|-,-,0:20000,-,-,-,-,0:20000|-,-,0:20000,-,-,0:20000,-,0:20000</pattern>
          </patternEngine>
        </pattern>
        <conditionalPattern>
          <target>1</target>
          <precondition>-base_and_snare</precondition>
          <postcondition>+base_and_snare</postcondition>
          <mode>replace</mode>
          <probability>40</probability>
          <patternEngine class="CrescendoPatternEngine">
            <patternTicks>
              <random list="32|64|128" />
            </patternTicks>
            <minVelocity>1</minVelocity>
            <maxVelocity>32767</maxVelocity>
            <velocityExponent>2</velocityExponent>
            <pattern>
              <random list="0/1|0/1:32767,0/1:24000" />
            </pattern>
          </patternEngine>
        </conditionalPattern>
        <conditionalPattern>
          <target>0</target>
          <precondition>+base_and_snare</precondition>
          <postcondition>-base_and_snare</postcondition>
          <mode>add</mode>
          <probability>40</probability>
          <patternEngine class="StringPatternEngine">
            <string>
              <random list="(0)*4|(0)*8|(0)*16" />
            </string>
          </patternEngine>
        </conditionalPattern>
      </sequenceEngine>
      <activityVector>base_and_snare</activityVector>
      <activityVector>base_and_snare</activityVector>
      <activityVector>hihat</activityVector>
      <activityVector>hihat</activityVector>
    </track>

    <track>
      <instrument>pad</instrument>
      <sequenceEngine class="PadSequenceEngine">
        <offsets>0,1,2</offsets>
        <velocity>15000</velocity>
      </sequenceEngine>
      <activityVector>pad</activityVector>
    </track>

    <track>
      <transposition>-24</transposition>
      <instrument>bass</instrument>
      <sequenceEngine class="PatternSequenceEngine">
        <patternEngine class="StringPatternEngine">
          <string>0,-,-,-,0,-,-,0,-,-,0,-,-,-1,-,-,0,-,-,-,0,-,-,0,-,-,0,-,-,-,+,-,0,-,-,-,0,-,-,0,-,-,0,-,-,-1,-,-,0,-,-,-,0,-,-,0,-,0,-,-,0,-,+,-</string>
          <string>0,-,-,0,-,-,0,2,0,-,-,0,-,-,-1,-,0,-,-,0,-,-,0,2,0,-,-,0,-,-,-1,-,0,-,-,0,-,-,0,2,0,-,-,0,-,-,-1,-,0,-,-,0,-,-,0,2,0,-,-,0,-,-,1,-</string>
          <string>0,-,0,-,0,-,-,0,-,0,-,0,0,-,+,-</string>
          <string>0,-,-,-,0,-,-,-,0,-,-,0,-,-,+,-,0,-,-,-,0,-,-,0,-,-,0,-,-,0,+,-,0,-,-,-,0,-,-,-,0,-,-,0,-,-,+,-,0,-,-,-,0,-,-,0,-,-,0,-,0,-,+,-</string>
          <string>-,-,0,-,-,-,0,-,-,-,0,-,-,-,0,-,-,-,0,-,-,-,0,-,-,-,0,-,-,-,+,-</string>
          <string>0,-,-,-,0,-,-,-,0,-,-,0,-,-,0,-,0,-,-,-,0,-,-,-,0,-,-,2,-,-,+,-,0,-,-,-,0,-,-,-,0,-,-,0,-,-,0,-,0,-,-,-,0,-,-,-,0,-,-,0,-,-,+,-</string>
          <string>0,-,-,3,-,-,0,-,1,-,-,0,-,-,3,-,0,-,-,3,-,-,0,-,1,-,-,0,-,2,1,-</string>
        </patternEngine>
      </sequenceEngine>
      <activityVector>bass</activityVector>
    </track>

    <track>
      <transposition>-36</transposition>
      <instrument>randombass</instrument>
      <sequenceEngine class="PatternSequenceEngine">
        <patternEngine class="RandomPatternEngine">
          <patternTicks>16</patternTicks>
          <patternString>
            <random list="A1,A2,A1,A3|A1,A2,A1,A3,A1,A2,A1,A4" />
          </patternString>
          <noteProbability>75</noteProbability>
          <legatoProbability>0</legatoProbability>
          <minVelocity>32767</minVelocity>
          <maxVelocity>32767</maxVelocity>
          <minActiveTicks>8</minActiveTicks>
          <maxActiveTicks>15</maxActiveTicks>
          <offsets>0,0,0,2,3,0,0,0</offsets>
          <noteLengths>1,2,3,2</noteLengths>
          <pauseLengths>1,2</pauseLengths>
          <pitchVelocityCorrelation>100</pitchVelocityCorrelation>
          <velocityExponent>3</velocityExponent>
        </patternEngine>
      </sequenceEngine>
      <activityVector>randombass</activityVector>
    </track>
  </arrangementEngine>

  <player class="MidiPlayer">
    <bpm>
      <random min="120" max="144" type="normal" variance="7" />
    </bpm>
    <transposition>
      <random min="65" max="69" />
    </transposition>
    <beforePlayWaitTicks>16</beforePlayWaitTicks>
    <afterPlayWaitTicks>16</afterPlayWaitTicks>
    <groove>
      <random list="100|110,90|115,85|125,75,115,85" />
    </groove>
    <!-- uncomment the following line if you want to write all generated songs as MIDI files -->
    <!-- <midiFilename>midifiles/${safeSongName}-${safeDeviceName}.mid</midiFilename> -->
    <device name="device1" clockSynchronization="true">Gervill,Microsoft GS Wavetable Synth,Microsoft GS Wavetable SW Synth,Java Sound Synthesizer</device>
    <map instrument="arpeggio" device="device1" channel="1" program="1" />
    <map instrument="accomp" device="device1" channel="2" program="1" />
    <map instrument="melody" device="device1" channel="3" program="2" />
    <map instrument="pad" device="device1" channel="4" program="92" />
    <map instrument="bass" device="device1" channel="5" program="40" />
    <map instrument="randombass" device="device1" channel="6" program="40" />
    <map instrument="percussion" device="device1" channel="10" />
  </player>
</SoundHelix>
